package com.zrwl.poscloud.core.restapi.file;

import com.zrwl.poscloud.commons.utils.ResultUtil;
import com.zrwl.poscloud.xo.service.FileInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

@Slf4j
@RestController
@RequestMapping("/fileDownload")
public class FileDownloadApi {

    @Autowired
    FileInfoService fileInfoService;

    /***
     * 下载文件
     * @param response
     */
    @RequestMapping("/getFileByCode")
    public String getFileByCode(HttpServletRequest request,HttpServletResponse response,String code) {
        return ResultUtil.successWithMessage(fileInfoService.getFileByCode(request,response,code));
    }

}
